#include <iostream>

using namespace std;
int main(int argc, char *argv[]) {
	int a ;
	int &ra = a ;//引用:变量别名
	
	a = 999;
	
	cout<<"&a:"<<&a<<endl; //&a:0x7fff5d5a948c
	cout<<"&ra:"<<&ra<<endl; //&ra:0x7fff5d5a948c
	cout<<"a:"<<a<<endl; //999
	cout<<"ra:"<<ra<<endl; //999
	
	cout<<"===================\n";
	int b = 888;
	ra = b ; //ra依旧是变量a的别名,仅888这个值给ra这个a的别名,b的地址没有给ra,a和ra地址相同,故对ra的操作就是对a的操作所以a的值是888
	
	cout<<"&a:"<<&a<<endl; //&a:0x7fff5d5a948c
	cout<<"&b:"<<&b<<endl; //&b:0x7fff5d5a947c
	cout<<"&ra:"<<&ra<<endl; //&ra:0x7fff5d5a948c
	cout<<"a:"<<a<<endl; //888
	cout<<"b:"<<b<<endl; //888
	cout<<"ra:"<<ra<<endl; //888
	
	ra = 1 ;
	
	cout<<"+++++++++++++++++++\n";
	
	cout<<"a:"<<a<<endl; //1
	cout<<"b:"<<b<<endl; //888
	cout<<"ra:"<<ra<<endl; //1
	
	
	return 0;
}